//
// Created by lenovo on 24-12-28.
//
class Solution4
{
public:
    static vector<int> singleNumber(vector<int>& nums)
    {
        int num = 0;

        for(int i : nums)
        {
            num ^= i;
        }

        int dif = (num == INT_MIN) ? num : (num & -num);;
        int num1 = 0;
        int num2 = 0;

        for(auto e : nums)
        {
            if(e & dif)
            {
                num1 ^= e;
            }
            else
            {
                num2 ^= e;
            }
        }
        return {num1,num2};
    }
};